#include "test_list.h"


#ifdef TEST_FLAG

#include "disable_warning.h"
#include "tools/flag.h"


#define TEST_FLAG_000
#define TEST_FLAG_001
#define TEST_FLAG_002

#define TEST_FLAG_003
#define TEST_FLAG_004
#define TEST_FLAG_005
#define TEST_FLAG_006
#define TEST_FLAG_007
#define TEST_FLAG_008
#define TEST_FLAG_009
#define TEST_FLAG_010
#define TEST_FLAG_011
#define TEST_FLAG_012
#define TEST_FLAG_013
#define TEST_FLAG_014
#define TEST_FLAG_015
#define TEST_FLAG_016
#define TEST_FLAG_017
#define TEST_FLAG_018
#define TEST_FLAG_019
#define TEST_FLAG_020
#define TEST_FLAG_021
#define TEST_FLAG_022
#define TEST_FLAG_023
#define TEST_FLAG_024
#define TEST_FLAG_025
#define TEST_FLAG_026
#define TEST_FLAG_027
#define TEST_FLAG_028
#define TEST_FLAG_029
#define TEST_FLAG_030
#define TEST_FLAG_031
#define TEST_FLAG_032

//------------------------------------------------------------------------------------------------------//


namespace{

    enum eFLAGS { eCLEAR = 0, eONE = 1<<1, eTWO = 1<<2, eTHREE = 1<<3 };
    typedef tools::TFlag<eFLAGS> Flag;

}//namespace
//------------------------------------------------------------------------------------------------------//

#ifdef TEST_FLAG_000
TEST(tools, flag_000)
{
    const Flag f;
    EXPECT_EQ(0,      f.GetByIntegral()     );
    EXPECT_EQ(true,   f.Empty()             );
    EXPECT_EQ(false, (f)? true: false       );
}
#endif // TEST_FLAG_000

#ifdef TEST_FLAG_001
TEST(tools, flag_001)
{
    Flag f(eONE);
    EXPECT_EQ(eONE,   f.GetByEnumeration()  );
    EXPECT_EQ(false,  f.Empty()             );
    EXPECT_EQ(true,  (f)? true: false       );
    EXPECT_EQ(true,   f.Has(eONE)           );
    EXPECT_EQ(false,  f.Has(eONE|eTWO)      );
    EXPECT_EQ(true,   f.HasAny(eONE|eTWO)   );
    EXPECT_EQ(false,  f.HasAny(eTWO|eTHREE) );
    EXPECT_EQ(true,   f.HasOnly(eONE)       );
    EXPECT_EQ(false,  f.HasOnly(eONE|eTWO)  );
}
#endif // TEST_FLAG_001

#ifdef TEST_FLAG_002
TEST(tools, flag_002)
{
    Flag f(eONE|eTWO);
    EXPECT_EQ(eONE|eTWO,    f.GetByEnumeration()    );
    EXPECT_EQ(false,        f.Empty()               );
    EXPECT_EQ(true,        (f)? true: false         );
    EXPECT_EQ(true,         f.Has(eONE)             );
    EXPECT_EQ(true,         f.Has(eONE|eTWO)        );
    EXPECT_EQ(false,        f.Has(eONE|eTWO|eTHREE) );
    EXPECT_EQ(true,         f.HasAny(eONE|eTWO)     );
    EXPECT_EQ(true,         f.HasAny(eTWO|eTHREE)   );
    EXPECT_EQ(false,        f.HasOnly(eONE)         );
    EXPECT_EQ(true,         f.HasOnly(eONE|eTWO)    );

    f.ValidOnly(eONE);

    EXPECT_EQ(eONE,   f.GetByEnumeration()  );
    EXPECT_EQ(false,  f.Empty()             );
    EXPECT_EQ(true,  (f)? true: false       );
    EXPECT_EQ(true,   f.Has(eONE)           );
    EXPECT_EQ(false,  f.Has(eONE|eTWO)      );
    EXPECT_EQ(true,   f.HasAny(eONE|eTWO)   );
    EXPECT_EQ(false,  f.HasAny(eTWO|eTHREE) );
    EXPECT_EQ(true,   f.HasOnly(eONE)       );
    EXPECT_EQ(false,  f.HasOnly(eONE|eTWO)  );
}
#endif // TEST_FLAG_002

#ifdef TEST_FLAG_003
TEST(tools, flag_003)
{
    const bool cond_false = false;
    const bool cond_true  = true;

    const Flag f1( cond_false, eONE|eTWO );
    EXPECT_EQ(true, f1.Empty() );

    const Flag f2( cond_true, eONE|eTWO) ;
    EXPECT_EQ(true, f2.Has(eONE|eTWO));
}
#endif // TEST_FLAG_003

#ifdef TEST_FLAG_004
#endif // TEST_FLAG_004

#ifdef TEST_FLAG_005
#endif // TEST_FLAG_005

#ifdef TEST_FLAG_006
#endif // TEST_FLAG_006

#ifdef TEST_FLAG_007
#endif // TEST_FLAG_007

#ifdef TEST_FLAG_008
#endif // TEST_FLAG_008

#ifdef TEST_FLAG_009
#endif // TEST_FLAG_009

#ifdef TEST_FLAG_010
#endif // TEST_FLAG_010

#ifdef TEST_FLAG_011
#endif // TEST_FLAG_011

#ifdef TEST_FLAG_012
#endif // TEST_FLAG_012

#ifdef TEST_FLAG_013
#endif // TEST_FLAG_013

#ifdef TEST_FLAG_014
#endif // TEST_FLAG_014

#ifdef TEST_FLAG_015
#endif // TEST_FLAG_015

#ifdef TEST_FLAG_016
#endif // TEST_FLAG_016

#ifdef TEST_FLAG_017
#endif // TEST_FLAG_017

#ifdef TEST_FLAG_018
#endif // TEST_FLAG_018

#ifdef TEST_FLAG_019
#endif // TEST_FLAG_019

#ifdef TEST_FLAG_020
#endif // TEST_FLAG_020

#ifdef TEST_FLAG_021
#endif // TEST_FLAG_021

#ifdef TEST_FLAG_022
#endif // TEST_FLAG_022

#ifdef TEST_FLAG_023
#endif // TEST_FLAG_023

#ifdef TEST_FLAG_024
#endif // TEST_FLAG_024

#ifdef TEST_FLAG_025
#endif // TEST_FLAG_025

#ifdef TEST_FLAG_026
#endif // TEST_FLAG_026

#ifdef TEST_FLAG_027
#endif // TEST_FLAG_027

#ifdef TEST_FLAG_028
#endif // TEST_FLAG_029

#ifdef TEST_FLAG_030
#endif // TEST_FLAG_030

#ifdef TEST_FLAG_031
#endif // TEST_FLAG_031

#ifdef TEST_FLAG_032
#endif // TEST_FLAG_032

#endif

#include "default_warning.h"

